/*
 * Copyright (c) 2018. QDU 2015 Java1 Team CompilationError
 */

package team.mai.antexpress.entities;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "bills", schema = "antexpress", catalog = "")
public class BillEntity {
	private String barcodeNo;
	private int centerId;
	private Integer approveUserId;
	private Integer delivermanId;
	private boolean modified;
	private boolean revoked;
	private String senderName;
	private String senderMobile;
	private String senderAddress;
	private String recipientName;
	private String recipientMobile;
	private String recipientAddress;

	@Id
	@Column(name = "barcode_no", nullable = false, length = 16)
	public String getBarcodeNo() {
		return barcodeNo;
	}

	public void setBarcodeNo(String barcodeNo) {
		this.barcodeNo = barcodeNo;
	}

	@Basic
	@Column(name = "center_id", nullable = false)
	public int getCenterId() {
		return centerId;
	}

	public void setCenterId(int centerId) {
		this.centerId = centerId;
	}

	@Basic
	@Column(name = "approve_user_id", nullable = true)
	public Integer getApproveUserId() {
		return approveUserId;
	}

	public void setApproveUserId(Integer approveUserId) {
		this.approveUserId = approveUserId;
	}

	@Basic
	@Column(name = "deliverman_id", nullable = true)
	public Integer getDelivermanId() {
		return delivermanId;
	}

	public void setDelivermanId(Integer delivermanId) {
		this.delivermanId = delivermanId;
	}

	@Basic
	@Column(name = "is_modified", nullable = false)
	public boolean isModified() {
		return modified;
	}

	public void setModified(boolean modified) {
		this.modified = modified;
	}

	@Basic
	@Column(name = "is_revoked", nullable = false)
	public boolean isRevoked() {
		return revoked;
	}

	public void setRevoked(boolean revoked) {
		this.revoked = revoked;
	}

	@Basic
	@Column(name = "sender_name", nullable = false, length = 32)
	public String getSenderName() {
		return senderName;
	}

	public void setSenderName(String senderName) {
		this.senderName = senderName;
	}

	@Basic
	@Column(name = "sender_mobile", nullable = false, length = 11)
	public String getSenderMobile() {
		return senderMobile;
	}

	public void setSenderMobile(String senderMobile) {
		this.senderMobile = senderMobile;
	}

	@Basic
	@Column(name = "sender_address", nullable = false, length = -1)
	public String getSenderAddress() {
		return senderAddress;
	}

	public void setSenderAddress(String senderAddress) {
		this.senderAddress = senderAddress;
	}

	@Basic
	@Column(name = "recipient_name", nullable = false, length = 32)
	public String getRecipientName() {
		return recipientName;
	}

	public void setRecipientName(String recipientName) {
		this.recipientName = recipientName;
	}

	@Basic
	@Column(name = "recipient_mobile", nullable = false, length = 11)
	public String getRecipientMobile() {
		return recipientMobile;
	}

	public void setRecipientMobile(String recipientMobile) {
		this.recipientMobile = recipientMobile;
	}

	@Basic
	@Column(name = "recipient_address", nullable = false, length = -1)
	public String getRecipientAddress() {
		return recipientAddress;
	}

	public void setRecipientAddress(String recipientAddress) {
		this.recipientAddress = recipientAddress;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		BillEntity that = (BillEntity) o;
		return centerId == that.centerId &&
				Objects.equals(barcodeNo, that.barcodeNo) &&
				Objects.equals(approveUserId, that.approveUserId) &&
				Objects.equals(delivermanId, that.delivermanId) &&
				Objects.equals(senderName, that.senderName) &&
				Objects.equals(senderMobile, that.senderMobile) &&
				Objects.equals(senderAddress, that.senderAddress) &&
				Objects.equals(recipientName, that.recipientName) &&
				Objects.equals(recipientMobile, that.recipientMobile) &&
				Objects.equals(recipientAddress, that.recipientAddress);
	}

	@Override
	public int hashCode() {

		return Objects.hash(barcodeNo, centerId, approveUserId, delivermanId, senderName, senderMobile, senderAddress, recipientName, recipientMobile, recipientAddress);
	}
}
